home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / gtk-1.2 / gtk / gtkcontainer.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-18  |  8.3 KB  |  236 lines

  1. /* GTK - The GIMP Toolkit
  2.  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
  3.  *
  4.  * This library is free software; you can redistribute it and/or
  5.  * modify it under the terms of the GNU Library General Public
  6.  * License as published by the Free Software Foundation; either
  7.  * version 2 of the License, or (at your option) any later version.
  8.  *
  9.  * This library is distributed in the hope that it will be useful,
  10.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.     See the GNU
  12.  * Library General Public License for more details.
  13.  *
  14.  * You should have received a copy of the GNU Library General Public
  15.  * License along with this library; if not, write to the
  16.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  17.  * Boston, MA 02111-1307, USA.
  18.  */
  19.  
  20. /*
  21.  * Modified by the GTK+ Team and others 1997-1999.  See the AUTHORS
  22.  * file for a list of people on the GTK+ Team.  See the ChangeLog
  23.  * files for a list of changes.  These files are distributed with
  24.  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
  25.  */
  26.  
  27. #ifndef __GTK_CONTAINER_H__
  28. #define __GTK_CONTAINER_H__
  29.  
  30.  
  31. #include <gdk/gdk.h>
  32. #include <gtk/gtkenums.h>
  33. #include <gtk/gtkwidget.h>
  34. #include <gtk/gtkadjustment.h>
  35.  
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif /* __cplusplus */
  40.  
  41.  
  42. #define GTK_TYPE_CONTAINER            (gtk_container_get_type ())
  43. #define GTK_CONTAINER(obj)            (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
  44. #define GTK_CONTAINER_CLASS(klass)      (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
  45. #define GTK_IS_CONTAINER(obj)            (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
  46. #define GTK_IS_CONTAINER_CLASS(klass)   (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
  47.  
  48. #define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
  49.  
  50.  
  51. typedef struct _GtkContainer       GtkContainer;
  52. typedef struct _GtkContainerClass  GtkContainerClass;
  53.  
  54. struct _GtkContainer
  55. {
  56.   GtkWidget widget;
  57.   
  58.   GtkWidget *focus_child;
  59.   
  60.   guint border_width : 16;
  61.   guint need_resize : 1;
  62.   guint resize_mode : 2;
  63.   guint reallocate_redraws : 1;
  64.   
  65.   /* The list of children that requested a resize
  66.    */
  67.   GSList *resize_widgets;
  68. };
  69.  
  70. struct _GtkContainerClass
  71. {
  72.   GtkWidgetClass parent_class;
  73.   
  74.   guint   n_child_args;
  75.  
  76.   void (* add)                   (GtkContainer     *container,
  77.                  GtkWidget     *widget);
  78.   void (* remove)              (GtkContainer     *container,
  79.                  GtkWidget     *widget);
  80.   void (* check_resize)        (GtkContainer     *container);
  81.   void (* forall)             (GtkContainer     *container,
  82.                  gboolean      include_internals,
  83.                  GtkCallback      callback,
  84.                  gpointer      callbabck_data);
  85.   gint (* focus)               (GtkContainer     *container,
  86.                  GtkDirectionType  direction);
  87.   void (* set_focus_child)    (GtkContainer     *container,
  88.                  GtkWidget     *widget);
  89.   GtkType (*child_type)        (GtkContainer    *container);
  90.   void    (*set_child_arg)    (GtkContainer     *container,
  91.                  GtkWidget        *child,
  92.                  GtkArg           *arg,
  93.                  guint             arg_id);
  94.   void    (*get_child_arg)    (GtkContainer    *container,
  95.                  GtkWidget        *child,
  96.                  GtkArg           *arg,
  97.                  guint             arg_id);
  98.   gchar*  (*composite_name)    (GtkContainer    *container,
  99.                  GtkWidget    *child);
  100.  
  101.   /* Padding for future expansion */
  102.   GtkFunction pad1;
  103.   GtkFunction pad2;
  104. };
  105.  
  106. /* Application-level methods */
  107.  
  108. GtkType gtk_container_get_type         (void);
  109. void    gtk_container_set_border_width     (GtkContainer       *container,
  110.                       guint            border_width);
  111. void    gtk_container_add         (GtkContainer       *container,
  112.                       GtkWidget       *widget);
  113. void    gtk_container_remove         (GtkContainer       *container,
  114.                       GtkWidget       *widget);
  115.  
  116. void    gtk_container_set_resize_mode    (GtkContainer     *container,
  117.                       GtkResizeMode     resize_mode);
  118.  
  119. void    gtk_container_check_resize       (GtkContainer     *container);
  120.  
  121. void    gtk_container_foreach         (GtkContainer       *container,
  122.                       GtkCallback        callback,
  123.                       gpointer        callback_data);
  124. void    gtk_container_foreach_full     (GtkContainer       *container,
  125.                       GtkCallback        callback,
  126.                       GtkCallbackMarshal marshal,
  127.                       gpointer        callback_data,
  128.                       GtkDestroyNotify  notify);
  129. GList* gtk_container_children         (GtkContainer       *container);
  130. gint   gtk_container_focus           (GtkContainer     *container,
  131.                         GtkDirectionType  direction);
  132.  
  133. /* Widget-level methods */
  134.  
  135. void   gtk_container_set_reallocate_redraws (GtkContainer    *container,
  136.                          gboolean         needs_redraws);
  137. void   gtk_container_set_focus_child       (GtkContainer     *container,
  138.                         GtkWidget         *child);
  139. void   gtk_container_set_focus_vadjustment (GtkContainer     *container,
  140.                         GtkAdjustment    *adjustment);
  141. void   gtk_container_set_focus_hadjustment (GtkContainer     *container,
  142.                         GtkAdjustment    *adjustment);
  143. void    gtk_container_register_toplevel       (GtkContainer     *container);
  144. void    gtk_container_unregister_toplevel  (GtkContainer     *container);
  145. GList*  gtk_container_get_toplevels        (void);
  146.  
  147. void    gtk_container_resize_children      (GtkContainer     *container);
  148.  
  149. GtkType gtk_container_child_type       (GtkContainer     *container);
  150.  
  151. /* the `arg_name' argument needs to be a const static string */
  152. void    gtk_container_add_child_arg_type   (const gchar      *arg_name,
  153.                         GtkType           arg_type,
  154.                         guint             arg_flags,
  155.                         guint             arg_id);
  156.      
  157. /* Allocate a GtkArg array of size nargs that hold the
  158.  * names and types of the args that can be used with
  159.  * gtk_container_child_getv/gtk_container_child_setv.
  160.  * if (arg_flags!=NULL),
  161.  * (*arg_flags) will be set to point to a newly allocated
  162.  * guint array that holds the flags of the args.
  163.  * It is the callers response to do a
  164.  * g_free (returned_args); g_free (*arg_flags).
  165.  */
  166. GtkArg* gtk_container_query_child_args       (GtkType           class_type,
  167.                         guint32          **arg_flags,
  168.                         guint             *nargs);
  169.  
  170. /* gtk_container_child_getv() sets an arguments type and value, or just
  171.  * its type to GTK_TYPE_INVALID.
  172.  * if GTK_FUNDAMENTAL_TYPE (arg->type) == GTK_TYPE_STRING, it's the callers
  173.  * response to do a g_free (GTK_VALUE_STRING (arg));
  174.  */
  175. void    gtk_container_child_getv       (GtkContainer      *container,
  176.                         GtkWidget          *child,
  177.                         guint           n_args,
  178.                         GtkArg          *args);
  179. void    gtk_container_child_setv          (GtkContainer      *container,
  180.                         GtkWidget          *child,
  181.                         guint           n_args,
  182.                         GtkArg          *args);
  183.  
  184. /* gtk_container_add_with_args() takes a variable argument list of the form:
  185.  * (..., gchar *arg_name, ARG_VALUES, [repeatedly name/value pairs,] NULL)
  186.  * where ARG_VALUES type depend on the argument and can consist of
  187.  * more than one c-function argument.
  188.  */
  189. void    gtk_container_add_with_args       (GtkContainer      *container,
  190.                         GtkWidget          *widget,
  191.                         const gchar          *first_arg_name,
  192.                         ...);
  193. void    gtk_container_addv           (GtkContainer      *container,
  194.                         GtkWidget          *widget,
  195.                         guint           n_args,
  196.                         GtkArg          *args);
  197. void    gtk_container_child_set           (GtkContainer      *container,
  198.                         GtkWidget         *child,
  199.                         const gchar          *first_arg_name,
  200.                         ...);
  201.      
  202.  
  203. /* Non-public methods */
  204.  
  205. void    gtk_container_queue_resize         (GtkContainer *container);
  206. void    gtk_container_clear_resize_widgets   (GtkContainer *container);
  207. void    gtk_container_arg_set             (GtkContainer *container,
  208.                           GtkWidget       *child,
  209.                           GtkArg       *arg,
  210.                           GtkArgInfo   *info);
  211. void    gtk_container_arg_get             (GtkContainer *container,
  212.                           GtkWidget       *child,
  213.                           GtkArg       *arg,
  214.                           GtkArgInfo   *info);
  215. gchar*    gtk_container_child_args_collect     (GtkType       object_type,
  216.                           GSList      **arg_list_p,
  217.                           GSList      **info_list_p,
  218.                           const gchar  *first_arg_name,
  219.                           va_list       args);
  220. gchar*  gtk_container_child_arg_get_info     (GtkType       object_type,
  221.                           const gchar  *arg_name,
  222.                           GtkArgInfo  **info_p);
  223. void    gtk_container_forall             (GtkContainer *container,
  224.                           GtkCallback   callback,
  225.                           gpointer        callback_data);
  226. gchar*    gtk_container_child_composite_name   (GtkContainer *container,
  227.                           GtkWidget       *child);
  228. void    gtk_container_dequeue_resize_handler (GtkContainer *container);
  229.  
  230. #ifdef __cplusplus
  231. }
  232. #endif /* __cplusplus */
  233.  
  234.  
  235. #endif /* __GTK_CONTAINER_H__ */
  236.